from typing import List
class Solution(object):
    def maxProfit(self, prices: List[int]) -> int:
        profit = 0
        for i in range(1, len(prices)):
            tmp = prices[i] - prices[i - 1]
            if tmp > 0: profit += tmp
        return profit


prices=[7,1,5,3,6,4]
s=Solution()
print(s.maxProfit(prices))